<template>
	<view class="waterfall">
		<view class="left">
			<view class="goods" v-for="(item, index) in leftData" :key="item.id" @click="goGoodDetail(item)">
				<!-- 图片 -->
				<view class="goods_pic">
					<image :src="item.goods_master_image" mode=""></image>
				</view>
				<!-- 活动/商品名 -->
				<view class="goods_cxname">
					<view class="cx" v-if="item.full_reductions.length > 0">促销</view>
					<view class="goods_name over">{{ item.goods_name }}</view>
				</view>
				<view class="youhui" v-if="item.full_reductions.length > 0">
					<view v-for="(v, n) in item.full_reductions">
						满{{ v.use_money }}减{{ v.money }}
						<image src="https://community.chuangxiangdianli.com/images/home/goods_biao.png" mode=""></image>
					</view>
					<!-- <view>满39减5满39减5<image src="https://community.chuangxiangdianli.com/images/home/goods_biao.png" mode=""></image></view> -->
				</view>
				<view class="goods_price">
					￥<text style="color: #F55519; font-size: 34rpx;">{{ item.goods_price }}</text><text>卖出{{ item.goods_sale }}单</text>
				</view>
			</view>
		</view>
		<view class="right">
			<view class="goods" v-for="(item, index) in rightData" :key="item.id" @click="goGoodDetail(item)">
				<!-- 图片 -->
				<view class="goods_pic">
					<image :src="item.goods_master_image" mode=""></image>
				</view>
				<!-- 活动/商品名 -->
				<view class="goods_cxname">
					<view class="cx" v-if="item.full_reductions.length > 0">促销</view>
					<view class="goods_name over">{{ item.goods_name }}</view>
				</view>
				<view class="youhui" v-if="item.full_reductions.length > 0">
					<view v-for="(v, n) in item.full_reductions">
						满{{ v.use_money }}减{{ v.money }}
						<image src="https://community.chuangxiangdianli.com/images/home/goods_biao.png" mode=""></image>
					</view>
					<!-- <view>满39减5满39减5<image src="https://community.chuangxiangdianli.com/images/home/goods_biao.png" mode=""></image></view> -->
				</view>
				<view class="goods_price">
					￥<text style="color: #F55519; font-size: 34rpx;">{{ item.goods_price }}</text><text>卖出{{ item.goods_sale }}单</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	// import request from '@/utils/request.js'
	export default{
		props: ['rightData', 'leftData'],
		data() {
			return{
			}
		},
		created() {
		},
		methods: {
			//  跳转商品详情
			goGoodDetail(item) {
				console.log('打印的商品数据', item)
				uni.navigateTo({
					url: '/other/goodsDetail/index?goods_id=' + item.id
				})
			},
		},
	}
</script>

<style lang="scss" scoped>
	.waterfall{
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		flex-wrap: wrap;
		width: 100%;
		&>view{
			width: calc(50% - 10rpx);
		}
		.goods{
			overflow: hidden;
			height: auto;
			background-color: #fff;
			border-radius: 8rpx;
			// margin: 22rpx 0;
			margin-top: 22rpx;
			.goods_pic{
				width: 100%;
				height: 328rpx;
				&>image{
					display: block;
					height: 100%;
					width: 100%;
				}
			}
			.goods_cxname{
				display: flex;
				flex-direction: row;
				align-items: center;
				justify-content: flex-start;
				padding: 0 20rpx;
				box-sizing: border-box;
				margin-top: 35rpx;
				margin-bottom: 18rpx;
				height: 28rpx;
				.cx{
					height: 28rpx;
					width: 50rpx;
					text-align: center;
					line-height: 28rpx;
					background-color: rgba(245, 85, 25, 1);
					font-size: 18rpx;
					font-family: Source Han Sans CN;
					font-weight: 500;
					color: #FFFFFF;
				}
				.goods_name{
					flex: 1;
					line-height: 28rpx;
					font-size: 25rpx;
					font-family: Source Han Sans CN;
					font-weight: 500;
					color: #2F2F2F;
				}
			}
			.youhui{
				display: flex;
				flex-direction: row;
				justify-content: flex-start;
				flex-wrap: nowrap;
				overflow: hidden;
				padding: 0 20rpx;
				box-sizing: border-box;
				margin-top: 15rpx;
				margin-bottom: 28rpx;
				&>view{
					position: relative;
					height: 34rpx;
					padding: 0 11rpx;
					box-sizing: border-box;
					text-align: center;
					line-height: 30rpx;
					font-size: 18rpx;
					font-family: Source Han Sans CN;
					font-weight: 500;
					color: #D53128;
					border-radius: 6rpx;
					margin-right: 10rpx;
					&>image{
						position: absolute;
						left: 0;
						top: 0;
						height: 100%;
						width: 100%;
					}
				}
				
			}
			.goods_price{
				width: 100%;
				height: 51rpx;
				padding-left: 20rpx;
				padding-right: 20rpx;
				padding-bottom: 25rpx;
				margin-top: 28rpx;
				box-sizing: border-box;
				font-size: 24rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #F55519;
				&>text{
					margin-right: 12rpx;
					font-size: 24rpx;
					color: rgba(153, 153, 153, 1);
				}
			}
		}
	}
</style>
